import { configureStore, combineReducers } from "@reduxjs/toolkit";

// 引入切片中的reducer
import counter from "./modules/counter";
import task from "./modules/task";

// 组装 rootReducer
const rootReducer = combineReducers({
  counter,
  task,
});

// 配置 store
const store = configureStore({
  // 根Reducer
  reducer: rootReducer,
});

export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;

export default store;
